package com.rfid.system.service.impl;

import java.util.List;

import com.rfid.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rfid.system.mapper.TOrderProductDetailMapper;
import com.rfid.system.domain.TOrderProductDetail;
import com.rfid.system.service.ITOrderProductDetailService;
import com.rfid.common.core.text.Convert;

/**
 * 单据明细Service业务层处理
 *
 * @author fangchen
 * @date 2020-12-24
 */
@Service
public class TOrderProductDetailServiceImpl implements ITOrderProductDetailService {

    @Autowired
    private TOrderProductDetailMapper tOrderProductDetailMapper;

    /**
     * 查询单据明细
     *
     * @param id 单据明细ID
     * @return 单据明细
     */
    @Override
    public TOrderProductDetail selectTOrderProductDetailById(Long id) {
        return tOrderProductDetailMapper.selectTOrderProductDetailById(id);
    }

    /**
     * 查询单据明细列表
     *
     * @param tOrderProductDetail 单据明细
     * @return 单据明细
     */
    @Override
    public List<TOrderProductDetail> selectTOrderProductDetailList(TOrderProductDetail tOrderProductDetail) {
        return tOrderProductDetailMapper.selectTOrderProductDetailList(tOrderProductDetail);
    }

    /**
     * 新增单据明细
     *
     * @param tOrderProductDetail 单据明细
     * @return 结果
     */
    @Override
    public int insertTOrderProductDetail(TOrderProductDetail tOrderProductDetail) {
        tOrderProductDetail.setCreateTime(DateUtils.getNowDate());
        return tOrderProductDetailMapper.insertTOrderProductDetail(tOrderProductDetail);
    }

    /**
     * 修改单据明细
     *
     * @param tOrderProductDetail 单据明细
     * @return 结果
     */
    @Override
    public int updateTOrderProductDetail(TOrderProductDetail tOrderProductDetail) {
        tOrderProductDetail.setUpdateTime(DateUtils.getNowDate());
        return tOrderProductDetailMapper.updateTOrderProductDetail(tOrderProductDetail);
    }

    /**
     * 删除单据明细对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTOrderProductDetailByIds(String ids) {
        return tOrderProductDetailMapper.deleteTOrderProductDetailByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除单据明细信息
     *
     * @param id 单据明细ID
     * @return 结果
     */
    @Override
    public int deleteTOrderProductDetailById(Long id) {
        return tOrderProductDetailMapper.deleteTOrderProductDetailById(id);
    }
}
